<?php
/////#########SERVER CONFIGURATION#########/////
$databaseaddress='localhost';
$databaseusername='';
$databasepassword='';
$databases='rpl';
/////#########SERVER CONFIGURATION#########/////

$con=mysql_connect($databaseaddress,$databaseusername,$databasepassword);
mysql_select_db($databases,$con);
$peminatan=$_POST['vote'];
$result=mysql_query("select quantity from voting where peminatan ='$peminatan'");
$quantity=mysql_fetch_array($result);
$quantity=$quantity['quantity'];
$quantity=$quantity+1;

mysql_query("update voting set quantity = '$quantity' where peminatan ='$peminatan' ");

echo "<table border='1'>
<tr>
	<th>Peminatan</th>
	<th>Hasil Voting</th>
</tr>";

$result=mysql_query("select * from voting");
while($data= mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $data['peminatan'] . "</td>";
echo "<td>" . $data['quantity'] . "</td>";
echo "</tr>";
}
echo "</table>";
echo "<br>";
echo "<a href='peminatan.html'>Back</a>";

mysql_close($con);
?>